package com.atcumt.bytedance;

import java.util.Scanner;

public class Main09 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] str = scanner.nextLine().split(" ");
        int[] nums = new int[str.length];
        for (int i = 0; i < str.length; i++) {
            nums[i] = Integer.valueOf(str[i]);
        }
        rob(nums);
    }

    public static void rob(int[] nums) {
        int n = nums.length;
        if (n == 1) {
            System.out.println(nums[0]);
        }
        if (n == 0 || nums == null) {
            System.out.println(0);
        }

        int[] dp = new int[n];
        dp[0] = nums[0];
        dp[1] = Math.max(nums[0], nums[1]);
        for (int i = 2; i < n; i++) {
            dp[i] = Math.max(dp[i - 1], dp[i - 2] + nums[i]);
        }
        System.out.println(dp[n - 1]);
    }
}
